{% extends "base.html" %}

{% block title7 %}
    active
{% endblock %}

{% block page-body %}
    <h1 class="page-header">数据修改</h1>

    <!--面板 开始-->
    <div class="panel panel-primary">
    <div class="panel-heading">主机信息修改</div>
    <div class="panel-body">
    <div class="row">
    <div class="col-md-12 main">
        {#        <form action="/search_hostinfo/" method="post">#}
        {#            {% csrf_token %}#}
        {#            <div class="col-md-4" style="padding-bottom: 4px;padding-left:0px">#}
        {#                <div class="input-group">#}
        {#                    <input name="ip" id="serach_ip" type="text" class="form-control" placeholder="请输入IP">#}
        {#                    <span class="input-group-btn"><button style="padding:6px 12px 7px;"#}
        {#                                                          class="btn btn-default"#}
        {#                                                          type="submit">搜索</button></span>#}
        {#                </div><!-- /input-group -->#}
        {#            </div>#}


        <form class="form-inline" action="/edit_hostinfo/?id={{ host_obj.id }}" method="post">
            {% csrf_token %}
            <div class="form-group">
                <div class="form-group ">
                    <span><strong>IP</strong></span>
                    <input name="ip" type="text" class="form-control  " id="ip" value={{ host_obj.ip }}>
                </div>
            </div>
            <div class="form-group form-inline">
                <div class=" form-group ">
                    <span><strong>厂商</strong></span>
                    <select name="vendor" type="text" style="display: inline" class="form-control" id="vendor"
                            value="aqjg">
                        {% for vendor in vendors %}
                            {% if host_obj.vendor_id == vendor.id %}

                                <option selected value="{{ host_obj.vendor_id }}">{{ host_obj.vendor.vendor }}</option>
                            {% else %}
                                <option value="{{ vendor.id }}">{{ vendor.vendor }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="form-group form-inline">
                <div class="form-group form-inline ">
                    <span><strong>业务</strong></span>
                    <select name="service" type="text" class="form-control" id="service">
                        {% for service in services %}
                            {% if service.id == host_obj.service_id %}
                                <option selected value="{{ host_obj.service_id }}">{{ host_obj.service.service }}</option>
                            {% else %}
                                <option value="{{ service.id }}">{{ service.service }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>
            </div>

            <div class="form-group form-inline">
                <span><strong>网段</strong></span>
                <select name="network" type="text" class="form-control" id="network">
                    {% for network in networks %}
                        {% if host_obj.network_id == network.id %}
                            <option selected value="{{ host_obj.network_id }}">{{ host_obj.network.network }}</option>
                        {% else %}
                            <option value="{{ network.id }}">{{ network.network }}</option>
                        {% endif %}
                    {% endfor %}
                </select>
            </div>

            <button id="add1" type="submit" class="btn btn-success ">提交</button>


        </form>
        <!--面板body 结束-->
    </div>
{% endblock %}

{% block page-script %}


{% endblock %}